'use strict';

const Controller = require('egg').Controller;
const fs = require('fs')
const path = require('path')
class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    let read = fs.readFileSync(path.join(__dirname, '../../database/data.json'), 'utf-8')
    console.log(read);
    try {
      ctx.body = {
        code: 1,
        msg: read
      }

    } catch {
      ctx.body = {
        code: 0,
        msg: '请求失败'
      }
    }

    ;

  }
}

module.exports = HomeController;
